<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>学生列表</title>
    <!-- 引入Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body {
            background-color: #f8f9fa;
        }
        .container {
            margin-top: 50px;
        }
        h1 {
            color: #333;
            text-align: center;
            margin-bottom: 30px;
        }
        table {
            background-color: #fff;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }
        th, td {
            text-align: center;
        }
    </style>
</head>
<body>
<div class="container">
    <h1 class="my-4">学生列表</h1>
    <table class="table table-striped table-hover">
        <thead>
        <tr>
            <th>学号</th>
            <th>姓名</th>
            <th>年龄</th>
            <th>性别</th>
            <th>班级</th>
        </tr>
        </thead>
        <tbody>
        {% for student in stuList %}
        <tr>
            <td>{{ student.id }}</td>
            <td>{{ student.name }}</td>
            <td>{{ student.age }}</td>
            <td>{{ student.sex }}</td>
            <td>{{ student.classid }}</td>
        </tr>
        {% endfor %}
        </tbody>
    </table>
    <nav aria-label="Page navigation">
        <ul class="pagination justify-content-center">
            {% if stuList.has_previous %}
            <li class="page-item"><a class="page-link" href="?page={{ stuList.previous_page_number }}">上一页</a></li>
            {% else %}
            <li class="page-item disabled"><a class="page-link" href="#">上一页</a></li>
            {% endif %}
            {% for i in stuList.paginator.page_range %}
            {% if stuList.number == i %}
            <li class="page-item active"><a class="page-link" href="#">{{ i }} <span
                    class="sr-only">(current)</span></a></li>
            {% else %}
            <li class="page-item"><a class="page-link" href="?page={{ i }}">{{ i }}</a></li>
            {% endif %}
            {% endfor %}
            {% if stuList.has_next %}
            <li class="page-item"><a class="page-link" href="?page={{ stuList.next_page_number }}">下一页</a></li>
            {% else %}
            <li class="page-item disabled"><a class="page-link" href="#">下一页</a></li>
            {% endif %}
        </ul>
    </nav>

</div>
<!-- 引入Bootstrap JavaScript -->
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.3/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.min.js"></script>
</body>
</html>
